package cn.dm.service;

import cn.dm.mapper.DmItemTypeMapper;
import cn.dm.pojo.DmItemType;
import cn.dm.vo.DmItemTypeVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
* Created by shang-pc on 2018/5/15.
*/
@RestController
public class RestDmItemTypeService {
    @Resource
    private DmItemTypeMapper dmItemTypeMapper;

    @RequestMapping(value = "/getDmItemTypeById", method = RequestMethod.POST)
    public DmItemType getDmItemTypeById(@RequestParam("id") Long id) throws Exception{
        return dmItemTypeMapper.getDmItemTypeById(id);
    }

    @RequestMapping(value = "/getDmItemTypeListByMap", method = RequestMethod.POST)
    public List<DmItemType> getDmItemTypeListByMap(@RequestBody Map<String, Object> param) throws Exception{
        return dmItemTypeMapper.getDmItemTypeListByMap(param);
    }

    @RequestMapping(value = "/getDmItemTypeCountByMap", method = RequestMethod.POST)
    public Integer getDmItemTypeCountByMap(@RequestBody Map<String, Object> param) throws Exception{
        return dmItemTypeMapper.getDmItemTypeCountByMap(param);
    }

    @RequestMapping(value = "/qdtxAddDmItemType", method = RequestMethod.POST)
    public Integer qdtxAddDmItemType(@RequestBody DmItemType dmItemType) throws Exception{
        return dmItemTypeMapper.insertDmItemType(dmItemType);
    }

    @RequestMapping(value = "/qdtxModifyDmItemType", method = RequestMethod.POST)
    public Integer qdtxModifyDmItemType(@RequestBody DmItemType dmItemType) throws Exception{
        return dmItemTypeMapper.updateDmItemType(dmItemType);
    }

    @RequestMapping(value = "/selectTestChildren", method = RequestMethod.POST)
    public List<DmItemTypeVo> selectTestChildren() throws Exception {
        return dmItemTypeMapper.selectTestChildren();
    }
}